#ifndef __PID_H
#define __PID_H

#include "main.h"
#include "stdlib.h"
#include "math.h"

typedef struct
{
    float current;       /*当前值*/
    float setpoint;      /*设定值*/
    float kp;            /*比例系数*/
    float ki;            /*积分系数*/
    float kd;            /*微分系数*/
    float error;         /*误差*/
    float lasterror;     /*前一拍偏差*/
    float output;        /*输出值*/ 
} PID;

extern PID pid;

void PID_Init(void);
void pid_ctrl(PID *pid);
void Walk_go(float Speed);
float VariableIntegralCoefficient(float error, float absmax, float absmin);

#endif
